ܸ

ߨௗ/ଶ

Γ ቀ݀

2 ൅1ቁ

(2.8)

e 2.12 shows an application of this K-nearest neighbour approach

ating the density of a Gaussian distribution with different nearest

r numbers. The density employing ten nearest neighbours is non-

The density employing 50 nearest neighbours improves the

ess. The density employing 100 nearest neighbours seems the best

of the smoothness and its capability of capturing the density shape.

seen that a density function can be more smooth if more nearest

rs are employed.

(a) (b) (c)

An illustration of using ten, 50 or 100 nearest neighbours for estimating the

ctions for the same data set using the K-nearest neighbour approach. (a) The

ploys ten nearest neighbours. (b) The density employs 50 nearest neighbours.

sity employs 100 nearest neighbours.

is no easy-to-use R package for the K-nearest neighbour density

n for one-dimensional data so far. The following code is a simple

e.

nction(x,z,K,d)

x-z)

er(D)

=x[or[1:K]]

th(subset)